/*
 * @lc app=leetcode.cn id=162 lang=golang
 *
 * [162] 寻找峰值
 */

// @lc code=start

func findPeakElement(nums []int) int {
	n := len(nums)

	l, r := 0, n-1
	mid := (r-l)/2 + l
	for l < r {
		if nums[mid] > nums[mid+1] {
			r = mid

		} else {
			l = mid + 1

		}
		mid = (r-l)/2 + l
	}
	return l

}

// @lc code=end
